package com.mybatis.Mapper;

import com.mybatis.entity.Employee;
import com.mybatis.service.EmployeeService;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface EmployeeMapper {
    /**
     * 查询
     *
     * @return
     */
    @Select("select *from employee")
    List<Employee> list();

    /**
     * 根据id删除员工
     *
     * @param id
     */
    @Delete("delete from employee where id = #{id}")
    void deleteById(Integer id);

    @Insert("insert into employee(id,name,username,password,phone) values(#{id},#{name},#{username},#{password},#{phone}) ")
    void save(Employee employee);

    @Select("select *from employee where id=#{id}")
    int getById(Integer id);


    @Update("update employee set id=#{id},name=#{name},username=#{username},password=#{password},phone=#{phone}")
    void remove(Employee employee);
}



